<template>
  <div class="book_page">
    <UserAvatar />

    <div class="book_list">
      <el-table class="el_table" size="small" :data="list" style="width: 100%">
        <el-table-column prop="date" label="预约信息">
          <template slot-scope="{row}">
            <div class="book_td">
              <span class="name">{{ row.hospitalName }}</span>
              <span class="sub" v-if="row.type == 2">医生：{{ row.doctorName }}</span>
              <span class="sub" v-if="row.type == 3">商品：{{ row.goodsName }}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="name" label="姓名" show-overflow-tooltip />
        <el-table-column prop="phone" label="联系电话" show-overflow-tooltip />
        <el-table-column prop="leaveWord" label="预约留言" show-overflow-tooltip />
        <el-table-column prop="createdDate" label="提交时间" show-overflow-tooltip />
      </el-table>
    </div>
  </div>
</template>
<script>
import UserAvatar from "@/components/user/index.vue";
import Comment from "@/components/comment/index.vue";
import { GET_PERSONAL_MYAPPOINTMENT } from "@/http/interface";
import { Table, TableColumn } from "element-ui";
export default {
  name: "MyBook",
  components: {
    [Table.name]: Table,
    [TableColumn.name]: TableColumn,
    UserAvatar,
    Comment,
  },
  data() {
    return {
      list: [],
    };
  },
  created() {
    this.getList();
  },
  methods: {
    async getList() {
      let res = await this.$axios.get(GET_PERSONAL_MYAPPOINTMENT);
      this.list = res.data || [];
    },
  },
};
</script>
<style lang="less" scoped>
@import "/assets/styles/index/my/book.less";
</style>